package com.springboot.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;
@Controller
public class UserController {
    @RequestMapping("/user/detail")
    public @ResponseBody Object userDetail(){

        Map<String,Object> retmap = new HashMap<String,Object>();
        retmap.put("id",1001);
        retmap.put("username","sm");
        return retmap;
    }

    @RequestMapping("/user/page/detail")
    public String userPageDetail(Model model){
        model.addAttribute("id",1001);
        model.addAttribute("username","sm");
        return "userDetail";
    }
}
